//
//  MLView.m
//  ZHJX(new)
//
//  Created by 杨磊 on 2020/12/31.
//  Copyright © 2020 杨磊. All rights reserved.
//

#import "MLView.h"

@implementation MLView


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
//        self.backgroundColor = [UIColor orangeColor];
        CGPoint centerPoint = CGPointMake(self.bounds.size.width /2, self.bounds.size.height /2);
        CGFloat radius = self.bounds.size.height /2;
        
        _circlePath = [UIBezierPath bezierPathWithArcCenter:centerPoint radius:radius startAngle:M_PI endAngle:-M_PI clockwise:NO];

        UIBezierPath * circlePath1 = [UIBezierPath bezierPathWithArcCenter:centerPoint radius:40 startAngle:M_PI endAngle:-M_PI clockwise:NO];
        CAShapeLayer *mlayer = [CAShapeLayer layer];
        mlayer.path = circlePath1.CGPath;
        mlayer.strokeColor = [UIColor orangeColor].CGColor;
        mlayer.fillColor = [UIColor orangeColor].CGColor;
        mlayer.lineWidth = 100;
        mlayer.strokeStart = 0;
        mlayer.strokeEnd = 1;
        [self.layer addSublayer:mlayer];


        CAShapeLayer *layer = [CAShapeLayer layer];
        layer.path = _circlePath.CGPath;
        layer.strokeColor = [UIColor redColor].CGColor;
        layer.fillColor = [UIColor clearColor].CGColor;
        layer.lineWidth = 100;
        layer.strokeStart = 0;
        layer.strokeEnd = (CGFloat)1/3;
        [self.layer addSublayer:layer];


        CAShapeLayer *layer1 = [CAShapeLayer layer];
        layer1.path = _circlePath.CGPath;
        layer1.strokeColor = [UIColor greenColor].CGColor;
        layer1.fillColor = [UIColor clearColor].CGColor;
        layer1.lineWidth = 100;
        layer1.strokeStart = (CGFloat)1/3;
        layer1.strokeEnd = (CGFloat)2/3;
        [self.layer addSublayer:layer1];


        
        CAShapeLayer *layer2 = [CAShapeLayer layer];
        layer2.path = _circlePath.CGPath;
        layer2.strokeColor = [UIColor magentaColor].CGColor;
        layer2.fillColor = [UIColor clearColor].CGColor;
        layer2.lineWidth = 100;
        layer2.strokeStart = (CGFloat)2/3;
        layer2.strokeEnd = 1;
        [self.layer addSublayer:layer2];
    }
    return self;
}


@end
